<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8">
  <title></title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    #fu {
      width: 100px;
      height: 100px;
      padding: 10px;
      border: 2px solid red;
      position: relative;
      top: 1px;
      left: 2px;
      margin-top: 10px;
      margin-left: 20px;
    }

    #son {
      width: 50px;
      height: 50px;
      top: 10px;
      left: 20px;      
      border: 6px solid green;
      position: absolute;
      padding: 2px;
      overflow-y: scroll;
      direction: rtl;
    }
  </style>
</head>

<body>

  <div id="fu">
    <p id="son">顺丰到付地方色东方舒服的地方</p>
  </div>
  <button onclick="myFunction()">点我</button>
  <script>
    function myFunction() {
      let child = document.querySelector('#son')
      console.log('child.border的宽 = ' + child.clientTop);
      console.log('边框和滚动条的和 = ' + child.clientLeft)
      console.log('内容+padding,不算滚动条' + child.clientWidth)
      console.log('内容+padding,不算滚动条clientHeight' + child.clientHeight)
      console.log("元素的宽度，内容+padding+border", child.offsetWidth)
      console.log("滚动条距离顶部的位置 -->"+child.scrollTop)
      console.log(child.scrollHeight)
      var elmnt = document.getElementById("fu");

      // 返回任何一个元素的高度 top+padding
      console.log("top+margin-->", elmnt.offsetTop)
      console.log("offsetLeft", elmnt.offsetLeft)
      console.log("元素的宽度，内容+padding+border", elmnt.offsetWidth)
    }
  </script>

</body>

</html>